#include <iostream>
#include <vector>
using namespace std;

void color(vector<vector<int>> & A,int x,int y)
{
	if( (x < 0) || (x >= A.size()) || (y < 0) || (y >= A[0].size())){
		return;
	}
	if(A[x][y] == 1){
		A[x][y] = 2;
		color(A,x-1,y);
		color(A,x+1,y);
		color(A,x,y-1);
		color(A,x,y+1);
	}
}

int pro(vector<vector<int>> & A,int x,int y,int val){
	
}

int shorttestBridge(vector<vector<int>> & A)
{
	for(int i=0;i<A.size();++i){
		for(int j=0;j<A[0].size();++j){
			if(A[i][j] == 1){
				color(A,i,j);
				goto out;
			}
		}
	}
out:


	return 0;
}

int main(int argc, char *argv[])
{
	
	return 0;
}

